package com.example.testforbookstore;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

import org.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

public class MeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.me);

        List<Book> testBookList = new ArrayList<>();
        testBookList.add(new Book(1,"hh1这个谁西安市西安市下狠手", "gbg", 20.12, R.drawable.test25, "good"));
        testBookList.add(new Book(2,"hh2", "gbg", 20.12, R.drawable.test26, "good"));
        testBookList.add(new Book(3,"hh3", "gbg", 20.12, R.drawable.test25, "good"));
        testBookList.add(new Book(4,"hh4", "gbg", 20.12, R.drawable.test26, "good"));

        RecyclerView recyclerView  = (RecyclerView) findViewById(R.id.me_book_list_recyclerList);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(new MeBooksAdapter(testBookList));
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.finished_layout);
        LinearLayout finishedListLayout = (LinearLayout) findViewById(R.id.recyclerList_layout);
        LinearLayout BaseInformationLayout = (LinearLayout) findViewById(R.id.order_score_address_layout);
        finishedListLayout.setVisibility(View.GONE);
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MeActivity.this, "你点击了finished, 隐藏基本信息", Toast.LENGTH_SHORT).show();
                BaseInformationLayout.setVisibility(View.GONE);
                finishedListLayout.setVisibility(View.VISIBLE);
            }
        });


    }

}